﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    public class ListDemo2
    {
        static void Main(string[] args)
        {
           
            List<StudentInfo> students = new List<StudentInfo>();
            //List<int> nos =new List<int>();
            StudentInfo stud = new StudentInfo();
            stud.Roll = 100;
            stud.Name = "Arun";
            students.Add(stud);

            StudentInfo stud2 = new StudentInfo();
            stud2.Roll = 101;
            stud2.Name = "Barun";
            students.Add(stud2);

            StudentInfo stud3 = new StudentInfo();
            stud3.Roll = 102;
            stud3.Name = "Bimal";
            students.Add(stud3);

            foreach (var student in students)
            {
                Console.WriteLine("Roll No. " + student.Roll);
                Console.WriteLine("Name     " + student.Name);
                Console.WriteLine("-------------------------------------");
            }

            //  var nm = names.Where(n => n.Equals("bbbbb")).FirstOrDefault();
            //  Console.WriteLine(nm);

            //Console.Write("Enter Roll ");
            //int roll = Convert.ToInt32(Console.ReadLine());
            //var st = students.Where(s => s.Roll == roll).FirstOrDefault();
            //if (st == null)
            //{
            //    Console.WriteLine("no data found");
            //}
            //else
            //{
            //    Console.WriteLine("Roll No. " + st.Roll);
            //    Console.WriteLine("Name     " + st.Name);
            //}
            Console.Read();
        }
    }
    class StudentInfo
    {
        public int Roll { get; set; }
        public string Name { get; set; }
    }
}
